Skip to content

Instantly share code, notes, and snippets.

View 0x6675636b796f75676974687562's full-sized avatar

Andrey S. 0x6675636b796f75676974687562

  • ex-@JetBrains, now Umbrella Corp.
  • Shenzhen, China
  • 14:32 (UTC +08:00)
View GitHub Profile
@wraithmonster
wraithmonster / process-command-line-options.sh
Created February 17, 2012 14:53
Parse command line options (parameters) in bash.
################################################################################
# Command line processing
################################################################################
# Parse the command line arguments.
while [ "$#" -gt "0" ]; do
case "$1" in
# TODO: Create some script options.
# EXAMPLE: Uncomment below to assign a 'destination directory', DST_DIR,
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/AtomMgr.h>
#include <Xm/PushB.h>
#include <Xm/Protocols.h>
Widget topLevel;
@dbapl
dbapl / .gitattributes
Last active August 31, 2022 09:56 — forked from kbaird/git_binary_diff_gist
Diff setup for ~/.gitconfig, .gitattributes file for repository and helper scripts.
*.ods diff=odf
*.odt diff=odf
*.odp diff=odf
*.pdf diff=pdf
*.PDF diff=pdf
*.apk diff=apk
*.bz2 diff=bz2
*.gz diff=gzip
*.zip diff=zip
*.tar diff=tar
@brettz9
brettz9 / .gitconfig
Last active February 27, 2023 09:44
Gitconfig which adds tools for Git GUI (Rebase, Revert, Stash, Tagging/Describe, (Arbitrary) command/git command, npm view, npm run, Git config, open file (and open this gist); Status for the fun of it)
[user]
name = Brett Zamir
email = brettz9@yahoo.com
[gui]
[gui]
encoding = utf-8
recentrepo = C:/wamp/www/_servers/me-pedia.org/me-pedia.org/extensions/intersection
recentrepo = C:/wamp/www/json-schema-spec
recentrepo = C:/wamp/www/file-type-icons
recentrepo = C:/wamp/www/symbols-tree-view
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active July 7, 2024 20:48
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@shiveshabhishek
shiveshabhishek / nerdtree.md
Last active July 5, 2024 11:23
Setup NERDTree in your VIM editor

The NERDTree is a file system explorer for the Vim editor. Using this plugin, users can visually browse complex directory hierarchies, quickly open files for reading or editing, and perform basic file system operations.

To install NERDTree

  1. Go to : https://github.com/scrooloose/nerdtree
  2. Clone the repo git clone https://github.com/scrooloose/nerdtree.git
  3. Create a directory , mkdir ~/.vim
  4. Move the contents of the repo to the new directory created mv /path/to/nerdtree-master/* ~/.vim/
  5. Now, open any file with vim and, first press Esc and then type : :NERDTree and you are done!
  6. To go out of NERDTree, press Esc and type q
@gtors
gtors / gist:effe8eef7dbe7052b22a009f3c7fc434
Created December 10, 2018 12:57
Makefile -> compilation_commands.json
@benasher44
benasher44 / kn_gtest_to_junit.sed
Last active February 28, 2023 15:45
K/N GTest Output to JUnit XML using sed
# Escape XML characters
s/&/\&amp;/g
s/"/\&quot;/g
s/'/\&apos;/g
s/</\&lt;/g
s/>/\&gt;/g
s/\[==========\] Running ([0-9]+) tests from [0-9]+ test cases./<testsuites><testsuite tests="\1">/g
s/\[ RUN \] ([[:alnum:]_-]+)\.(.+)/<testcase classname="\1" name="\2">/g
s/\[----------\].+//g
@ajkaanbal
ajkaanbal / Makefile
Created March 29, 2019 16:41 — forked from saitoha/Makefile
SIXEL color graphics DEMO (xterm pl#301 and gnuplot)
#
# SIXEL color graphics DEMO
#
# xterm pl#301 with --enable-sixel-graphics option
# gnuplot with --with-bitmap-terminals option
#
# Now the color palette of xterm VT-340 mode is limited to 16.
# If you want to change it to 256, apply the following patch.
# https://gist.github.com/saitoha/7822989/raw/20727b88f0f826bfcb9d644907944b29a456b67f/graphics.c.diff
#
@t27
t27 / linux-oom-killer-fixes.md
Last active June 14, 2024 12:39
Dealing with the Linux OOM Killer

Dealing with the Linux OOM Killer at the program level

Do this in cases when you dont want to change the os-level settings, but only want to disable the OOM killer for a single process. This is useful when youre on a shared machine/server.

The OOM killer uses the process level metric called oom_score_adj to decide if/when to kill a process. This file is present in /proc/$pid/oom_score_adj. The oom_score_adj can vary from -1000 to 1000, by default it is 0.

You can add a large negative score to this file to reduce the probability of your process getting picked and terminated by OOM killer. When you set it to -1000, it can use 100% memory and still avoid getting terminated by OOM killer.