Skip to content

Instantly share code, notes, and snippets.

@NIA
NIA / whichpkg.sh
Created March 19, 2015 09:50
whichpkg: who installed this command?
# whichpkg: which package installed this command?
# Detects builtins and follows symlinks. Add the code below to .bashrc/.bash_aliases
# Usage examples:
#
# nia$ whichpkg vim
# vim-gtk: /usr/bin/vim.gtk
#
# nia$ whichpkg type
# type встроена в оболочку
#
@raspi
raspi / gettext_update.sh
Created July 1, 2014 17:03
Shell script for updating Gettext .po files in a PHP project. Create new languages simply by copying base.pot to <language code>.po. For example: cp base.pot fi.po. Then just edit fi.po with poedit or some other editor.
#!/bin/bash -e
# generate file list
echo -e "" > files.txt
find ../application -type f \( -iname "*.php" -or -iname "*.phtml" \) -exec readlink -f "{}" \; > files.txt
# scan files
xgettext --force-po --add-comments --from-code=UTF-8 --language=php --package-name=app --package-version=1.0 --msgid-bugs-address=noreply@example.com -o base.pot -f files.txt
# base pot -> <lang>.po update
@cypok
cypok / ledger_graph.rb
Last active July 1, 2021 01:44
Script to visualize your expenses and assets using Ledger
#!/usr/bin/env ruby
# encoding: utf-8
require 'date'
def bad_usage
puts "Usage: ledger_graph <output.svg> month_expenses <limit> [<year> <month>]"
puts " or: ledger_graph <output.svg> last_assets <months>"
exit
end
//
// Xcode324iOS41TestSuiteWorkaround.m
//
// This source file provides a work-around to enable running unit tests
// against the iPhone Simulator in Xcode 3.2.4 with iOS SDK 4.1.
//
// This work-around is only needed when using Xcode 3.2.4 to target iOS 4.1.
//
// Copyright 2010 Apple Inc. All rights reserved.
//
# Put this to ~/.irbrc (no extension)
require "rubygems"
require 'irb/completion'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
# IRB & Readline hostory
module Readline
module History
@AntonLydike
AntonLydike / risc-v.tex
Last active March 6, 2024 16:37
RISC-V Assembler lstlisting syntax and style
% RISC-V Assembler syntax and style for latex lstlisting package
%
% These are risc-v commands as per our university (University Augsburg, Germany) guidelines.
%
% Author: Anton Lydike
%
% This code is in the public domain and free of licensing
% language definition
\lstdefinelanguage[RISC-V]{Assembler}
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule