Skip to content

Instantly share code, notes, and snippets.

View pzskc383's full-sized avatar

Alexander D. pzskc383

View GitHub Profile
@wavezhang
wavezhang / java_download.sh
Last active June 6, 2024 15:19
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@sardemff7
sardemff7 / pinentry-rofi.rb
Last active July 31, 2023 15:09
Pinentry rofi-based bare implementation
#! /usr/bin/env ruby
# Copyright © 2016 Quentin "Sardem FF7" Glidic
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@jagtesh
jagtesh / arel_patches.rb
Created February 23, 2016 19:07
Arel goodness (with CASE statement) in < v7
# Remove this for Arel v7.0
module Arel
module Nodes
class Case < Arel::Nodes::Node
include Arel::OrderPredications
include Arel::Predications
include Arel::AliasPredication
attr_accessor :case, :conditions, :default
@mbreit
mbreit / *scratch*.el
Created November 27, 2014 14:11
Emacs: haml-lint checker for flycheck
(flycheck-def-config-file-var flycheck-haml-lintrc haml-lint ".haml-lint.yml"
:safe #'stringp)
(flycheck-define-checker haml-lint
"A haml-lint syntax checker"
:command ("haml-lint"
(config-file "--config" flycheck-haml-lintrc)
source)
:error-patterns
((warning line-start
<?php
namespace Acme\Html;
use Illuminate\Html\FormBuilder as IlluminateFormBuilder;
class FormBuilder extends IlluminateFormBuilder {
/**
* An array containing the currently opened form groups.
@stefanschmidt
stefanschmidt / osx-software-update-urls.txt
Created January 4, 2014 01:22
URLs of the index files used by the software update client on OS X
10.3 (Panther): http://swscan.apple.com/scanningpoints/scanningpointX.xml
10.4 (Tiger): http://swscan.apple.com/content/catalogs/index-1.sucatalog
10.5 (Leopard): http://swscan.apple.com/content/catalogs/others/index-leopard.merged-1.sucatalog
10.6 (Snow Leopard): http://swscan.apple.com/content/catalogs/others/index-leopard-snowleopard.merged-1.sucatalog
10.7 (Lion): http://swscan.apple.com/content/catalogs/others/index-lion-snowleopard-leopard.merged-1.sucatalog
10.8 (Mountain Lion): http://swscan.apple.com/content/catalogs/others/index-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog
10.9 (Mavericks): http://swscan.apple.com/content/catalogs/others/index-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog
10.9 (Mavericks incl. seeds): http://swscan.apple.com/content/catalogs/others/index-10.9seed-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog

Displaying images in the terminal with tput and echo

output

Requires ImageMagick, easily available from your favorite package manager. Tested on Linux and OSX
convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n "  ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash
@marcbelmont
marcbelmont / gist:5259298
Created March 28, 2013 00:01
Extract Skype chats / conversations from preferences (main.db file), convert them to html and send them to an email using Gmail stmp.
# -*- coding: utf-8 -*-
"""
Skype database access functionality.
@author Erki Suurjaak
@created 26.11.2011
@modified 07.03.2013
"""
import copy
import csv
@fxposter
fxposter / gist:1301190
Created October 20, 2011 13:51
DO NOT EVER DO THIS AT HOME
Application.Views.Network.RelationControl = (function () {
var view = { events: {} };
var toggleMap = [
[['accept_profile', 'decline_profile'], ['friendship_request_block']],
[[{ post: 'friend_profile' }, { ajaxDelete: 'unfriend_profile' }], ['trust_block', 'distrust_block']],
[[{ post: 'subscribe_profile' }, { ajaxDelete: 'unsubscribe_profile' }], ['subscribe_block', 'unsubscribe_block']],
[['accept_employment', 'decline_employment'], ['employment_request_block']],
[[{'post':'create_employment'}, {'ajaxDelete':'remove_employment'}], ['employment_block']],
[['promote_to', 'demote_from'], ['employment_role_block']]
];
#!/bin/sh
# More correct version in ruby: https://gist.github.com/725094
# Instant timesheet - straight from yo git log!
# ...now with commit times as well
git log --committer=`git config --get user.email` --format="%ad %s" --simplify-merges --date=iso --since="1 week ago" --reverse | uniq -w 11 --all-repeated=prepend | sed "s/^\(.\{11\}\)\(.\{5\}\).\{9\}/\1\2/" | sed "s/^$//;ta;s/^.\{11\}//;bend;:a;n;s/ /\\n===========\\n\\n/;:end" |grep -iv "merge branch"