Skip to content

Instantly share code, notes, and snippets.

@z448
z448 / bookmarks.pl
Last active April 7, 2023 13:02
search iOS Safari bookmarks from commandline or export for Firefox
#!/usr/bin/env perl
# work in progress (use revision 3 https://gist.github.com/z448/1c27621fad750bcc969f72ef4112af1f/64709b1fededfef305f360df73d3ece07f297833)
use 5.010;
use warnings;
use strict;
use Data::Dumper;
use JSON::PP;
@z448
z448 / git_branch_in_terminal_prompt.sh
Created June 14, 2016 08:33
display current git branch in terminal prompt
#!/bin/bash
# to display current git branch in terminal prompt on start of session add this to your ~/.bashrc file
# ex.: if you are in folder which is git repository switched to master branch your prompt will look like
# /home/joe [master] _
#
# source http://perltricks.com/article/displaying-the-git-branch-in-the-terminal-prompt-with-perl/
function current_git_branch {
git branch 2> /dev/null | perl -ne 'print " [$_]" if s/^\*\s+// && chomp'
@z448
z448 / git_branchin_terminal_prompt.sh
Created June 14, 2016 08:25
git branch in terminal prompt
{"foot":["<div class=\"footer\" align=\"center\" >dpp<br></div>\n","</body>\n","</html>\n"],"style":["<style type=\"text/css\"> \n","\n",".slideshow-overlay {\n"," display: block;\n"," position: fixed;\n"," left: 0;\n"," top: 0;\n"," overflow: hidden;\n"," z-index: -99;\n"," height: 100%;\n"," width: 100%;\n","}\n","\n",".fa-download {\n"," background: #090311;\n","}\n","\n",".dpp {\n"," background: #090311;\n","}\n","\n",".headtext {\n","\tfont-family: 'Fira Mono';\n","\tfont-size: 11px;\n"," text-align = \"center\";\n","\tbackground : #090311;\n"," color: #8E8E8E;\n"," top: 2px;\n"," left: 0;\n"," right: 0;\n","}\n","\n",".description {\n","\tfont-family: 'Fira Mono';\n","\tfont-size: 11px;\n"," text-align = \"center\";\n","\tbackground : #090311;\n"," color: #4F4F50;\n","}\n","\n",".code{\n"," font-size: 10px;\n"," bottom: 5px;\n","\n","}\n","\n",".module {\n"," font-family: 'Open Sans', sans-serif;\n"," text-align = \"center\";\n","\tfont-size
@z448
z448 / sslca4curl.pl
Last active May 26, 2016 08:18
Download and setup Mozilla certificates for curl SSL/TLS acces
#!/usr/bin/env perl
##########################################################################
##
## FILE: curl-setup-ssl.pl
## USAGE: Add to your ~/.bashrc or export from command line
## export `curl-ssl-setup.pl`
## DESCRIPTION: Download and setup Mozilla certificates for curl SSL/TLS
##
## OPTIONS: -h for help
@z448
z448 / get-gist.sh
Last active November 20, 2016 19:25
list users public gists
perl -e 'print "add user and <Enter> and <Ctrl-D>:";
$url=q|https://gist.github.com|;
while(<>){ $g = $url . q|/| . $_ }; open( my $GS,"-|","curl -#ksL $g");
while(<$GS>){
if( m|tr.+ate| ){
s/(.*?)(\=\")(.*?)(\".*?\>)(.*?\>)(.*?)(\<.*)/$3$6/;
$gist->{$6} = $3;
}};
for(keys %$gist){ print $_ . " -\> " . $url . $gist->{$_} . "\n" };
'
@z448
z448 / vim-tips.txt
Created February 18, 2016 02:29
shortcuts
source: https://www.instapaper.com/text?u=http%3A%2F%2Fzzapper.co.uk%2Fvimtips.html
__BEGIN__
*vimtips.txt* For Vim version 7.3.
------------------------------------------------------------------------------
" new items marked [N] , corrected items marked [C]
" *best-searching*
/joe/e : cursor set to End of match
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C]
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down
@z448
z448 / Net::SSLeay.md
Created February 13, 2016 07:54
errors

###IO::Socket::SSL fail

dyld: lazy symbol binding failed: Symbol not found: _CRYPTO_THREADID_get_callback Referenced from: /Users/z/perl5/lib/perl5/darwin-thread-multi-2level/auto/Net/SSLeay/SSLeay.bundle Expected in: flat namespace

dyld: Symbol not found: _CRYPTO_THREADID_get_callback Referenced from: /Users/z/perl5/lib/perl5/darwin-thread-multi-2level/auto/Net/SSLeay/SSLeay.bundle Expected in: flat namespace

@z448
z448 / __.sh
Last active March 24, 2016 19:14
shells
#!/bin/bash
# term line bash4>
printf "%`tput cols`s"|tr ' ' '-'
@z448
z448 / check_lib.pl
Last active May 6, 2019 15:45
perls
#!/usr/bin/env perl
# cklib
# checks if lib is in $path /$ARGV[0]/
use 5.010;
use FFI::CheckLib;
check_lib_or_exit( lib => 'jpeg', symbol => 'jinit_memory_mgr' );
check_lib_or_exit( lib => [ 'iconv', 'jpeg' ] );
# or prompt for path to library and then: print "where to find jpeg library: ";
my $path = <STDIN>;
@z448
z448 / perl-locale-fix.sh
Last active December 19, 2015 17:38
random.pl.sh
## try to add into .bash_profile if you see folowing locale errors
##################################################################
## perl: warning: Setting locale failed.
## perl: warning: Please check that your locale settings:
## LANGUAGE = (unset),
## LC_ALL = (unset),
## LANG = "en_US.UTF-8"
## are supported and installed on your system.
## perl: warning: Falling back to the standard locale ("C").