Skip to content

Instantly share code, notes, and snippets.

@magkopian
magkopian / .conkyrc
Last active August 25, 2016 22:52
The .conkyrc file of my Debian desktop. Based on /u/cheloo's .conkyrc from Reddit, the original can be found here: http://pastebin.com/rFZVeQFC.
View .conkyrc
conky.config = {
color1 = 'd70751', -- Debian Red
--set to = true if you want Conky to be forked in the background
background = true,
own_window = true,
own_window_type = 'desktop',
own_window_transparent = false,
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
@magkopian
magkopian / website-dl
Last active May 30, 2016 18:26
A simple script that allows the recursive download of an entire website.
View website-dl
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 [ULR]"
exit 1
fi
url=$1
if [[ $url != http?(s)://* ]]; then
url="http://$url"
@magkopian
magkopian / number_format.js
Last active November 10, 2015 23:16
A JavaScript equivalent of PHP’s number_format - http://goo.gl/eHQ44X
View number_format.js
function number_format(number, decimals, dec_point, thousands_sep) {
// http://kevin.vanzonneveld.net
// + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfix by: Michael White (http://getsprink.com)
// + bugfix by: Benjamin Lupton
// + bugfix by: Allan Jensen (http://www.winternet.no)
// + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// + bugfix by: Howard Yeend
// + revised by: Luke Smith (http://lucassmith.name)
@magkopian
magkopian / clock.php
Last active November 10, 2015 23:16
A simple JavaScript clock that automaticly syncs time using AJAX - Server (Client: https://gist.github.com/magkopian/7a97ff98c3cafe14972e)
View clock.php
<?php
if ( isset($_GET['action']) && !empty($_GET['action']) && $_GET['action'] == 'get_time' ) {
header('Content-type: application/json');
echo json_encode (
array (
'year' => date('Y'),
'month' => date('m'),
'day' => date('d'),
'hour' => date('h'),
'minute' => date('i'),
@magkopian
magkopian / clock_view.php
Last active May 1, 2022 02:53
A simple JavaScript clock that automaticly syncs time using AJAX - Client (Server: https://gist.github.com/magkopian/f0724fa7faa629d302db)
View clock_view.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Ajax Clock</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
@magkopian
magkopian / newrelic-daemon.patch
Last active November 7, 2015 21:44
Patch that makes the newrelic-daemon to run as the user newrelic-php instead of root. It works only on Debian or Debian based distros. You can find more information on the following link https://discuss.newrelic.com/t/daemon-running-as-root/16651/7.
View newrelic-daemon.patch
--- original/etc/init.d/newrelic-daemon 2015-11-07 18:52:55.441693757 +0200
+++ edited/etc/init.d/newrelic-daemon 2015-11-07 20:13:17.994378592 +0200
@@ -16,6 +16,7 @@
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
LABEL=newrelic-daemon
NAME=newrelic-daemon
+USER=newrelic-php
DESC="New Relic Daemon"
id=`id -u 2> /dev/null`
@magkopian
magkopian / clock.c
Created September 19, 2015 14:55
Ncurses version of "A natural language clock program for the RaspberryPi." More info: http://www.instructables.com/id/Natural-language-clock-for-RaspberryPi/
View clock.c
/*********************************************************
* Filename: clock.c
*
* Original Author: JRV31 (http://www.instructables.com/member/JRV31/)
*
* A natural language clock program for the RaspberryPi.
*
* Compile with the command:
* gcc -o clock clock.c -lncurses
*