Skip to content

Instantly share code, notes, and snippets.

View diogovk's full-sized avatar

Diogo Kersting diogovk

  • Astra Finance
  • Jaraguá do Sul - SC - Brazil
View GitHub Profile
@diogovk
diogovk / concat_using_append_comparison
Created January 30, 2014 00:30
compares the speed of concat using append, and recursive version.
defmodule ListOps do
# Please don't use any external modules (especially List) in your
# implementation. The point of this exercise is to create these basic functions
# yourself.
#
# Note that `++` is a function from an external module (Kernel, which is
# automatically important`) and so shouldn't be used either.
@diogovk
diogovk / gist:9217554
Last active August 29, 2015 13:56
Private method style in Ruby
class Style1
def some_public_method
end
def another_public_method
end
private
###### JADE ####
1 doctype html
2 html(lang=en, ng-app="myApp")
3 head
4 title= "titulo 2"
5 body
6 h1 This is a test
7 ng-view
@diogovk
diogovk / gist:22f35fd8a0a34aedaeaf
Created June 26, 2014 15:25
Elixir -> javascript Challenge
iex(1)> l = [1, 2, 3]
#=> [1, 2, 3]
iex(2)> l2 = tl(l)
#=> [2, 3]
iex(3)> l2 = [ 0 | l2 ]
#=> [0, 2, 3]
iex(4)> IO.inspect l
[1, 2, 3]
#=> [1, 2, 3]
iex(5)> IO.inspect l2
cd /home/horacio/Documentos/temp/license-vision
while read user ; do
echo $user
cp *.ucl /mnt/appusu/"$user"/Systex5
cp *.uvz /mnt/appusu/"$user"/Systex5
cp *.jar /mnt/appusu/"$user"/Systex5/shell/
cp *.[dD][Ll][Ll] /mnt/appusu/"$user"/Systex5/shell/funcoes/
done < /home/horacio/Downloads/all.bat
#!/usr/bin/python3
def idempotent(other):
myset={1,2,3}
return myset.union(other)
def non_idempotent(other):
mylist=[1,2,3]
mylist.extend(other)
return mylist
#include <stdio.h>
void printhex(signed char c) {
printf("%x %d\n", c , c );
}
int main(){
printhex(0x0); /* => 0 0 */
printhex(0x30); /* => 30 48 */
printhex(0x1f); /* => 1f 28 */
#include <stdio.h>
/*
* Para compilar e executar
* gcc -std=c11 % && time ./a.out
*/
/* isto aqui é magica pra mim. Magia negra */
unsigned long long int nexthi_same_count_ones(unsigned long long a) {
/* works for any word length */
unsigned long long int c = (a & -a);
; random - programa que imprime uma letra e um digito aleatório em Linux/x86
; para compilar:
; nasm -f elf -g -F dwarf -l random.lst random.asm32
; ld -o random random.o
; syscalls
%define sys_exit 1
%define sys_read 3
%define sys_write 4
%define sys_open 5
defmodule ListOps do
# Please don't use any external modules (especially List) in your
# implementation. The point of this exercise is to create these basic functions
# yourself.
#
# Note that `++` is a function from an external module (Kernel, which is
# automatically important`) and so shouldn't be used either.
@spec count(list) :: non_neg_integer