Skip to content

Instantly share code, notes, and snippets.

@greymd
greymd / sudo新一.md
Last active May 13, 2024 23:56
sudo新一

 オレは高校生シェル芸人 sudo 新一。幼馴染で同級生の more 利蘭と遊園地に遊びに行って、黒ずくめの男の怪しげな rm -rf / 現場を目撃した。端末をみるのに夢中になっていた俺は、背後から近づいてきたもう1人の --no-preserve-root オプションに気づかなかった。 俺はその男に毒薬を飲まされ、目が覚めたら・・・ OS のプリインストールから除かれてしまっていた!

sudo がまだ $PATH に残っていると奴らにバレたら、また命を狙われ、他のコマンドにも危害が及ぶ』

 上田博士の助言で正体を隠すことにした俺は、 which に名前を聞かれて、とっさに『gnuplot』と名乗り、奴らの情報をつかむために、父親がシェル芸人をやっている蘭の $HOME に転がり込んだ。ところが、このおっちゃん・・・とんだヘボシェル芸人で、見かねた俺はおっちゃんになりかわり、持ち前の権限昇格能力で、次々と難タスクを解決してきた。おかげで、おっちゃんは今や世間に名を知られた名エンジニア、俺はといえばシェル芸 bot のおもちゃに逆戻り。クラスメートの convertojichattextimg にお絵かきコマンドと誤解され少年ワンライナーお絵かき団を結成させられる始末。

 ではここで、博士が作ってくれたメカを紹介しよう。最初は時計型麻酔 kill 。ふたについた照準器にあわせてエンターを押せば、麻酔シグナルが飛び出し、プロセスを瞬時に sleep させることができる。 次に、蝶ネクタイ型 banner 。裏についているダイヤルを調整すれば、ありとあらゆる大きさのメッセージを標準出力できる。必殺のアイテムなら fork 力増強シューズ。電気と磁力で足を刺激し、 :(){ :|:& };: でプロセステーブ

@minagi
minagi / gist:1c8b991c61899e318a52
Created October 11, 2014 02:34
BOOKMARKLET: View original size of twimg
// BOOKMARKLET: View original size of twimg
// cf. http://storagebox.xxxxxxxx.jp/tools/twitter_img_originalsize.html
// 2014/10/11 fix: 元ソースより、画像を複数含むpost表示時のマッチ条件を修正
javascript:url=location.href;
src=document.getElementsByTagName('html')[0].innerHTML;
resul=url;
if(url.match(new RegExp('pbs.twimg.com','i'))){
if(url.match(RegExp(':large','i'))){
@davidedmundson
davidedmundson / PlasmaNested.sh
Last active May 13, 2024 23:49
Run plasma from within gamescope
#!/bin/sh
# Remove the performance overlay, it meddles with some tasks
unset LD_PRELOAD
## Shadow kwin_wayland_wrapper so that we can pass args to kwin wrapper
## whilst being launched by plasma-session
mkdir $XDG_RUNTIME_DIR/nested_plasma -p
cat <<EOF > $XDG_RUNTIME_DIR/nested_plasma/kwin_wayland_wrapper
#!/bin/sh
@aabiji
aabiji / yt.py
Created April 7, 2024 15:39
Youtube video downloader
"""
A tiny youtube video downloader.
usage: yt.py [-h] [--only-audio] [--num_retries NUM_RETRIES] [--output OUTPUT] video_url
Built by Abigail Adegbiji on April 7, 2024.
Inspried by this blog post: https://tyrrrz.me/blog/reverse-engineering-youtube-revisited
Note that the get_video_info function will be subject to change when Youtube changes their api.
Also note that ffmpeg and ffmpeg-python are required dependencies.
"""
<!-- saved from url=(0057)file:///C:/Users/puerc/OneDrive/Escritorio/PornoDude.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><center>
<form action="http://www.google.com/search" method="GET">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><table bgcolor=""><tbody><tr><td>
<a href="http://www.google.com/">
<img align="absmiddle" alt="Google" border="0" src="./PornoDude_files/logo-r.svg"></a><br><br><input maxlength="255" name="q" size="31" type="text" value="">
<span style="color: #2b00fe;"><input name="btnG" type="submit" value="Búsqueda PornoDude"></span></td></tr></tbody></table>
</form>
</center>
@ijleesw
ijleesw / install-openmp-macos.sh
Created December 4, 2018 14:45
Install OpenMP on MacOS
#!/bin/bash
# Install
brew install llvm
brew install libomp
# Compile
# clang++ test.cpp -o test -Xpreprocessor -fopenmp -lomp

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step).

    git clone git@github...some-repo.git
@brotherkaif
brotherkaif / settings.json
Created September 12, 2023 17:19
LazyVim keymappings for VSCode
{
"vim.showMarksInGutter": false,
"vim.foldfix": true,
"vim.surround": true,
"vim.easymotion": true,
"vim.easymotionKeys": "asdghklqwertyuiopzxcvbnmfj",
"vim.leader": "<space>",
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [":", "w", "<CR>"],

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@leocomelli
leocomelli / git.md
Last active May 13, 2024 23:30
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda