Skip to content

Instantly share code, notes, and snippets.

Avatar

Neutron Stein neutronstein

View GitHub Profile
@neutronstein
neutronstein / pause_resume.go
Created Dec 19, 2020 — forked from ik5/pause_resume.go
Example on pause and resume threads in golang
View pause_resume.go
package main
import (
"fmt"
"runtime"
"time"
)
// Thread stages
const (
@neutronstein
neutronstein / HasWhereNotTrait.php
Created Jul 31, 2020 — forked from waska14/HasWhereNotTrait.php
app/Traits/HasWhereNotTrait.php
View HasWhereNotTrait.php
<?php
namespace App\Traits;
use Closure;
use Illuminate\Database\Eloquent\Builder;
trait HasWhereNotTrait
{
/**
@neutronstein
neutronstein / main.dart
Last active May 11, 2020 — forked from collinjackson/main.dart
PageView example with dots indicator
View main.dart
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
View repo.ex
defmodule Recruitee.Repo do
use Ecto.Repo, otp_app: :recruitee
import Ecto.Query
@doc """
Stream query results
Example:
iex> Candidate
...> |> where([c], c.foo > 4)
View gist:5abd6a9b46de0c9f895713dba99546da
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@neutronstein
neutronstein / sse.go
Created Apr 6, 2019 — forked from ismasan/sse.go
Example SSE server in Golang
View sse.go
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
View gist:f196beb49865f44e3928ec055f70b357
sudo yum install -y pam-devel
sudo yum install -y rpm-build
sudo yum install -y zlib-devel
mkdir -p ~/rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz.asc
# verify the file
# update the pam ssd from the one included on the system
@neutronstein
neutronstein / share_text_attach_ace.js
Last active Apr 23, 2016 — forked from geakstr/share_text_attach_ace.js
Ace editor (v1.2.3) and ShareJS (v0.7.40) text adapter
View share_text_attach_ace.js
function attachAce(editor, doc) {
if (!doc.provides.text) {
throw new Error("Cannot attach ace to non-text share document");
}
let suppress = false;
editor.setValue(doc.getSnapshot() || "");
check();
const newline = editor.session.getDocument().getNewLineCharacter();
View res_color_btn_flat_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/flat_disabled_text"/>
<item android:color="@color/flat_normal_text"/>
</selector>