Skip to content

Instantly share code, notes, and snippets.

@schaary
schaary / ssh_agent_start.fish
Created May 11, 2012 07:33
Auto-launching ssh-agent in fish shell
setenv SSH_ENV $HOME/.ssh/environment
if [ -n "$SSH_AGENT_PID" ]
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null
if [ $status -eq 0 ]
test_identities
end
else
if [ -f $SSH_ENV ]
. $SSH_ENV > /dev/null
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 22, 2024 20:20
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@zemlanin
zemlanin / fonts.conf
Last active December 15, 2015 20:49 — forked from robotslave/gist:4633393
Emoji in Ubuntu
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<!--
1. Download the Symbola font:
http://users.teilar.gr/~g1951d/Symbola707.zip
2. unzip the file and put Symbola.ttf (and any of the other fonts that strike your fancy)
in your ~/.fonts/ directory
3. run `fc-cache -f`. You can check to make sure the new fonts
@dodyg
dodyg / gist:5616605
Last active November 21, 2022 03:05
Kotlin Programming Language Cheat Sheet Part 2

This is a quick guide to Kotlin programming language. The previous part of this guide is here

#Object Oriented

fun main(args : Array<String>) {
  class local (val x : Int)
  
  val y = local(10)
 println("${y.x}")
@dodyg
dodyg / gist:5823184
Last active March 29, 2024 03:59
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@rsff
rsff / ssh_agent_start.fish
Last active March 14, 2019 08:56 — forked from schaary/ssh_agent_start.fish
ssh agent for fish
#this script can never fail
#i use it in the fish_config
#call it with start_agent
setenv SSH_ENV $HOME/.ssh/environment
function start_agent
if [ -n "$SSH_AGENT_PID" ]
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null
@AlexDaniel
AlexDaniel / save-me-from-texas.creole
Last active March 14, 2017 01:01
Save me from Texas

⚠⚠⚠⚠⚠⚠⚠ ↓↓↓ PAGE MOVED ↓↓↓ ⚠⚠⚠⚠⚠⚠⚠

I moved this page to rakudo wiki. A lot of people wanted to add stuff, but gists are not editable. A wiki is a more appropriate place for this kind of stuff. Rakudo wiki is possibly not the best place for it, but for now that will do.

Plus, GitHub gists totally suck when unicode characters are involved. There's also no preview option here. So I'm glad that it is being moved.

⚠⚠⚠⚠⚠⚠⚠ ↑↑↑ PAGE MOVED ↑↑↑ ⚠⚠⚠⚠⚠⚠⚠

Recently Perl 6 got support for various unicode characters (½ ¹ ∞ × ÷, see this link for a full list), but I don't think that we are done. Here is a list of things to think about.

#!/usr/bin/env perl6
use v6.c;
sub MAIN(Str $module) {
my $cu = $*REPO.need(CompUnit::DependencySpecification.new(:short-name($module)));
say "Dist: " ~ $cu.repo.prefix.child('dist/' ~ $cu.distribution.id);
say "Source: " ~ $cu.repo.prefix.child('sources/' ~ $cu.distribution.provides{$module}.values[0]<file>);
}
our sub MAIN_HELPER($retval = 0) is export {
say "doing getopty stuff!";
my $m = callframe(1).my<&MAIN>;
return $retval unless $m;
say 'calling MAIN with no args';
$m();
}
@AlexDaniel
AlexDaniel / splits.md
Last active February 17, 2016 16:52
Array splits

Is there a cute Perl 6 way to take an array (say ‘a’..‘d’) and get all head/tail partitions of it (e.g. (<a>, <b c d>), (<a b>, <c d>), (<a b c>, <d>))?

Sure! Pick one:

my @a = a..e; say (@a[^$_, $_..*] for 1..^@a);
my @b = a..e; say (1..^@b).map: {@b[^$_, $_..*]};
my @c = a..e; say (@c.rotor($_, ∞, :partial) for 1..^@c);
my @z = a..e; say @z[0..*-2].keys.map: {@z[0..$_, $_^..*]}; # same as b
my @d = a..e; say (1..^@d).map: {@d.rotor: $_, ∞, :partial};