Skip to content

Instantly share code, notes, and snippets.

View luginbash's full-sized avatar
😀

Luginbash luginbash

😀
View GitHub Profile
@lixin9311
lixin9311 / driver.go
Created May 12, 2022 09:23
Go generic datastore db driver
package dbdriver
import (
"context"
"errors"
"reflect"
"cloud.google.com/go/datastore"
)
@Chaz6
Chaz6 / fetch-ipset-from-asn.bash
Last active May 13, 2022 07:46
Generate an ipset for a given autonomous system number
#!/bin/bash
usage()
{
echo "Usage: $0 [ASN]"
}
if [ $# -ne 1 ]; then
usage
exit 1
@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
@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'
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@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)
@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";
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
void draw_() {
@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
;
@sindresorhus
sindresorhus / post-merge
Last active May 2, 2024 03:18
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"