Skip to content

Instantly share code, notes, and snippets.

Avatar

David B. Bitton davidbitton

View GitHub Profile
View lsyncd.conf.lua
--
-- lsyncd conf file
--
settings {
delay = 1,
maxProcesses = 5,
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd-status.log",
}
@davidbitton
davidbitton / gist:3030772
Created Jul 2, 2012
Why is it always 1?!
View gist:3030772
static GLKVector4 HslToRgb(float h, float s, float l, float a);
static GLKVector4 HslToRgb(float h, float s, float l, float a) {
float r = 0.0f, g = 0.0f, b = 0.0f;
float temp1, temp2;
if(l == 0.0f)
{
r = g = b = 0.0f;
}
else
@davidbitton
davidbitton / token_replace.sh
Created May 22, 2012
Replace a token in a file from a Bash script using Perl
View token_replace.sh
#!/bin/bash
perl - /var/www/html/wp-config.php <<'EOF'
use strict;
use warnings;
$^I = '.bak';
my $keys = `curl -sS https://api.wordpress.org/secret-key/1.1/salt/`;
while(<>) {
if (/\{KEYS_TOKEN\}/){
@davidbitton
davidbitton / ServiceStackFormatter.cs
Created Mar 2, 2012
Using ServiceStack.Test JsonSerializer in a Web API MediaTypeFormatter
View ServiceStackFormatter.cs
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using ServiceStack.Text;
namespace HttpClientTest.Formatters {
public class ServiceStackFormatter : MediaTypeFormatter {
public ServiceStackFormatter() {
// Fill out the mediatype and encoding we support
@davidbitton
davidbitton / gist:1094320
Created Jul 20, 2011
sphere vertex and index generation
View gist:1094320
- (void)setupSphere {
std::vector<vertexStruct> verticesVector;
std::vector<int> indicesVector;
double latitudeBands = 30;
double longitudeBands = 30;
double radius = 2;
for (double latNumber = 0; latNumber <= latitudeBands; latNumber++) {
double theta = latNumber * M_PI / latitudeBands;
@davidbitton
davidbitton / TransmitView.xaml
Created Apr 25, 2011
ActualWidth Binding Fail
View TransmitView.xaml
<UserControl x:Class="OsgExporter.Shell.Views.TransmitView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" Loaded="TransmitView_OnLoaded"
d:DesignHeight="312" d:DesignWidth="496">
<Grid x:Name="LayoutRoot">
<Grid Margin="8,0,0,0" Height="Auto" VerticalAlignment="Center">
<Grid.RowDefinitions>
You can’t perform that action at this time.