Skip to content

Instantly share code, notes, and snippets.

View luginbash's full-sized avatar
😀

Luginbash luginbash

😀
View GitHub Profile
@adambard
adambard / stupid_tricks.matlab
Created May 3, 2012 23:23
Stupid MATLAB Tricks.
function stupid_tricks
% I made some functional tools for MATLAB.
assert(reduce_(@(x, y) x + y, [1, 2, 3, 4]) == 10)
% They got a little out of hand.
join = @(sep, args) ...
if_(ischar(sep), @() ... % Input check
reduce_(@(x, y) [x sep y], ... % Reduce to string
map_(@num2str, args))); % Convert args to string.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 30, 2024 04:25
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@sindresorhus
sindresorhus / post-merge
Last active July 25, 2024 06:53
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@tluyben
tluyben / gist:f8b19965eaab6d236f9b
Created May 1, 2014 10:29
Atari 2600 ET sourcecode 1982
LIST OFF
; *** E . T. T H E E X T R A - T E R R E S T R I A L ***
; Copyright 1982 Atari, Inc.
; Designer: Howard Scott Warshaw
; Artist: Jerome Domurat
; Analyzed, labeled and commented
; by Dennis Debro
; Last Update: July 18, 2006
;
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
void draw_() {
@alesegdia
alesegdia / opera25_to_html_bookmarks.php
Last active November 13, 2016 23:21
Parser from Opera 25 (developer) JSON to HTML bookmarks file.
<?php
# Tested on Ubuntu 14.04 with Opera Developer 25 Bookmarks file and imported successfully to Google Chrome.
# Opera developer folder in Ubuntu 14.04: ~/.config/opera-developer. See Opera About dialog for other OSes.
# The JSON file that we have to parse is in /$OPERA_FOLDER/Bookmarks
# Usage: php opera25_to_html_bookmarks.php Bookmarks output_file.html
if( count($argv) != 3 ) echo "Usage: php opera25_to_html_bookmarks.php Bookmarks output_file.html\n\n";
@krzyzanowskim
krzyzanowskim / integerWithBytes
Last active May 30, 2018 03:36
integerWithBytes Swift way
// Playground - noun: a place where people can play
import Foundation
typealias Byte = UInt8
protocol GenericIntegerType: IntegerType {
init(_ v: Int)
init(_ v: UInt)
init(_ v: Int8)
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@graceavery
graceavery / harryPotterAliases
Last active May 10, 2023 02:51
bash aliases for Harry Potter enthusiasts
alias accio=wget
alias avadaKedavra='rm -f'
alias imperio=sudo
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"'
alias stupefy='sleep 5'
alias wingardiumLeviosa=mv
alias sonorus='set -v'
alias quietus='set +v'
@tiran
tiran / 99-pkiuser-pcsc.rules
Created August 22, 2018 10:39
NitroHSM support for Dogtag
/* polkit rule to allow 'pkiuser' to access NitroHSM PCSC interface
*
* file name: /etc/polkit-1/rules.d/99-pkiuser-pcsc.rules
*
* Resources:
* - https://access.redhat.com/blogs/766093/posts/1976313
* - https://raymii.org/s/articles/Get_Started_With_The_Nitrokey_HSM.html
*
* Installation:
* # dnf install opensc pcsc-lite pcsc-tools